import 'package:flutter/material.dart';
import '../model/data.dart';
class ListViewDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    Widget _buildItem(BuildContext context, int index) {
      return Container(
        child: Column(
          children: <Widget>[
            Image.network(posts[index].imgUrl),
            SizedBox(
              height: 16.0,
            ),
            Text(
              posts[index].title,
              style: Theme.of(context).textTheme.title,
            ),
            Text(
              posts[index].subTitle,
              style: Theme.of(context).textTheme.subhead,
            ),SizedBox(height: 16.0,)
          ],
        ),
        margin: EdgeInsets.all(8.0),
        color: Colors.white,
      );
    }

    // TODO: implement build
    return ListView.builder(
      itemCount: posts.length,
      itemBuilder: _buildItem,
    );
  }
}